<?php
#	BuildNav for Dreamweaver MX v0.2
#              10-02-2002
#	Alessandro Crugnola [TMM]
#	sephiroth: alessandro@sephiroth.it
#	http://www.sephiroth.it
#	
#	Function for navigation build ::
function buildNavigation($pageNum_Recordset1,$totalPages_Recordset1,$prev_Recordset1,$next_Recordset1,$separator=" | ",$max_links=10, $show_page=true)
{
                GLOBAL $maxRows_personal_member_r,$totalRows_personal_member_r;
	$pagesArray = ""; $firstArray = ""; $lastArray = "";
	if($max_links<2)$max_links=2;
	if($pageNum_Recordset1<=$totalPages_Recordset1 && $pageNum_Recordset1>=0)
	{
		if ($pageNum_Recordset1 > ceil($max_links/2))
		{
			$fgp = $pageNum_Recordset1 - ceil($max_links/2) > 0 ? $pageNum_Recordset1 - ceil($max_links/2) : 1;
			$egp = $pageNum_Recordset1 + ceil($max_links/2);
			if ($egp >= $totalPages_Recordset1)
			{
				$egp = $totalPages_Recordset1+1;
				$fgp = $totalPages_Recordset1 - ($max_links-1) > 0 ? $totalPages_Recordset1  - ($max_links-1) : 1;
			}
		}
		else {
			$fgp = 0;
			$egp = $totalPages_Recordset1 >= $max_links ? $max_links : $totalPages_Recordset1+1;
		}
		if($totalPages_Recordset1 >= 1) {
			#	------------------------
			#	Searching for $_GET vars
			#	------------------------
			$_get_vars = '';			
			if(!empty($_GET) || !empty($HTTP_GET_VARS)){
				$_GET = empty($_GET) ? $HTTP_GET_VARS : $_GET;
				foreach ($_GET as $_get_name => $_get_value) {
					if ($_get_name != "pageNum_personal_member_r") {
						$_get_vars .= "&$_get_name=$_get_value";
					}
				}
			}
			$successivo = $pageNum_Recordset1+1;
			$precedente = $pageNum_Recordset1-1;
			$firstArray = ($pageNum_Recordset1 > 0) ? "<a href=\"$_SERVER[PHP_SELF]?pageNum_personal_member_r=$precedente$_get_vars\">$prev_Recordset1</a>" :  "$prev_Recordset1";
			# ----------------------
			# page numbers
			# ----------------------
			for($a = $fgp+1; $a <= $egp; $a++){
				$theNext = $a-1;
				if($show_page)
				{
					$textLink = $a;
				} else {
					$min_l = (($a-1)*$maxRows_personal_member_r) + 1;
					$max_l = ($a*$maxRows_personal_member_r >= $totalRows_personal_member_r) ? $totalRows_personal_member_r : ($a*$maxRows_personal_member_r);
					$textLink = "$min_l - $max_l";
				}
				$_ss_k = floor($theNext/26);
				if ($theNext != $pageNum_Recordset1)
				{
					$pagesArray .= "<a href=\"$_SERVER[PHP_SELF]?pageNum_personal_member_r=$theNext$_get_vars\">";
					$pagesArray .= "$textLink</a>" . ($theNext < $egp-1 ? $separator : "");
				} else {
					$pagesArray .= "$textLink"  . ($theNext < $egp-1 ? $separator : "");
				}
			}
			$theNext = $pageNum_Recordset1+1;
			$offset_end = $totalPages_Recordset1;
			$lastArray = ($pageNum_Recordset1 < $totalPages_Recordset1) ? "<a href=\"$_SERVER[PHP_SELF]?pageNum_personal_member_r=$successivo$_get_vars\">$next_Recordset1</a>" : "$next_Recordset1";
		}
	}
	return array($firstArray,$pagesArray,$lastArray);
}
?>
<?php require_once('../../../Connections/shopcarda1.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$currentPage = $_SERVER["PHP_SELF"];

$maxRows_personal_member_r = 10;
$pageNum_personal_member_r = 0;
if (isset($_GET['pageNum_personal_member_r'])) {
  $pageNum_personal_member_r = $_GET['pageNum_personal_member_r'];
}
$startRow_personal_member_r = $pageNum_personal_member_r * $maxRows_personal_member_r;

mysql_select_db($database_shopcarda1, $shopcarda1);
$query_personal_member_r = "SELECT personal_member.pm_id, personal_member.id_card, personal_member.p_status, company_member.company, personal_member.name FROM personal_member, company_member WHERE personal_member.cm_id=company_member.cm_id";
$query_limit_personal_member_r = sprintf("%s LIMIT %d, %d", $query_personal_member_r, $startRow_personal_member_r, $maxRows_personal_member_r);
$personal_member_r = mysql_query($query_limit_personal_member_r, $shopcarda1) or die(mysql_error());
$row_personal_member_r = mysql_fetch_assoc($personal_member_r);

if (isset($_GET['totalRows_personal_member_r'])) {
  $totalRows_personal_member_r = $_GET['totalRows_personal_member_r'];
} else {
  $all_personal_member_r = mysql_query($query_personal_member_r);
  $totalRows_personal_member_r = mysql_num_rows($all_personal_member_r);
}
$totalPages_personal_member_r = ceil($totalRows_personal_member_r/$maxRows_personal_member_r)-1;

$queryString_personal_member_r = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_personal_member_r") == false && 
        stristr($param, "totalRows_personal_member_r") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_personal_member_r = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_personal_member_r = sprintf("&totalRows_personal_member_r=%d%s", $totalRows_personal_member_r, $queryString_personal_member_r);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/admin_page.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>無標題文件</title>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
#cantainer {
	width: 955px;
	margin-right: 33px;
	margin-left: 33px;
}
#header {
	width: 955px;
	margin-bottom: 10px;
	background-image: url(../../../images/top_bg.png);
	height: 82px;
}
#body {
	width: 955px;
	margin-bottom: 10px;
}
#footer {
	width: 955px;
}
.style2 {color: #666666;
	font-size: 12px;
}
#contant_list {
	float: left;
	width: 180px;
	margin-right: 10px;
}
.style17 {color: #74B9E5; font-size: 14px; }
.style43 {font-size: 12px; color: #666666; font-weight: bold; }
#contant_body {
	float: right;
	width: 765px;
}
-->
</style>
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
#contant_body_header {
	height: 62px;
	width: 765px;
	background-image: url(../../images/admin_personal_list_header.png);
	margin-bottom: 10px;
}
#contant_body_body {
	width: 765px;
	margin-bottom: 10px;
}
#contnat_body_1 {
	background-image: url(../../images/admin_personal_list_text.png);
	height: 25px;
	width: 737px;
	margin-bottom: 10px;
	margin-right: 10px;
	margin-left: 10px;
}
#contant_body_2 {
	width: 737px;
	margin-right: 10px;
	margin-bottom: 10px;
	margin-left: 10px;
}
#contant_body_3 {
	width: 737px;
	margin-right: 10px;
	margin-bottom: 10px;
	margin-left: 10px;
}
#contant_body_4 {
	width: 737px;
	margin-right: 10px;
	margin-bottom: 10px;
	margin-left: 10px;
}
.style4 {font-size: 12px}
-->
</style>
<!-- InstanceEndEditable -->
</head>

<body>
<table width="1024" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div id="cantainer">
      <div id="header"></div>
      <div id="body">
        <div id="contant_list">
          <table border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td align="center"><img src="../../../images/index_12.png" width="180" height="54" /></td>
            </tr>
            <tr>
              <td><table width="180" border="0" align="center" cellpadding="0" cellspacing="0" background="../../../images/index_12_20.png">
                  <tr>
                    <td width="10"></td>
                    <td><table border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                          <td align="center"><span class="style17">＞</span></td>
                          <td align="left" class="style43">商品管理</td>
                        </tr>
                        <tr>
                          <td width="30" align="center">&nbsp;</td>
                          <td width="127" align="left" class="style2"><a href="../../product/admin_product_add.html">新增商品</a><br />
                            <a href="../../product/admin_product_change_list.html">產品資訊管理</a><br /></td>
                        </tr>
                        <tr>
                          <td colspan="2"><img src="../../../images/dotsline.png" width="167" height="11" /></td>
                        </tr>
                        <tr>
                          <td align="center"><span class="style17">＞</span></td>
                          <td align="left"><strong class="style43">會員管理</strong></td>
                        </tr>
                        <tr>
                          <td align="center">&nbsp;</td>
                          <td align="left" class="style2"><a href="../company_member/admin_companym_add.html">新增公司會員</a><br />
                            <a href="../company_member/admin_companym_list.html">公司會員管理</a><br />
                            <a href="admin_pearsonal_list.html">個人會員管理</a></td>
                        </tr>
                        <tr>
                          <td colspan="2"><img src="../../../images/dotsline.png" alt="" width="167" height="11" /></td>
                        </tr>
                        <tr>
                          <td align="center"><span class="style17">＞</span></td>
                          <td align="left" class="style43">供應商管理</td>
                        </tr>
                        <tr>
                          <td align="center">&nbsp;</td>
                          <td align="left" class="style2"><a href="../../supplier/admin_supplier_brand.html">品牌管理</a></td>
                        </tr>
                        <tr>
                          <td colspan="2"><img src="../../../images/dotsline.png" alt="" width="167" height="11" /></td>
                        </tr>
                        <tr>
                          <td align="center"><span class="style17">＞</span></td>
                          <td align="left" class="style43">進銷存管理</td>
                        </tr>
                        <tr>
                          <td align="center">&nbsp;</td>
                          <td align="left" class="style2">進貨管理<br />
                            訂單管理</td>
                        </tr>
                        <tr>
                          <td colspan="2" align="center"><img src="../../../images/dotsline.png" alt="" width="167" height="11" /></td>
                          </tr>
                        <tr>
                          <td align="center"><span class="style17">＞</span></td>
                          <td align="left" class="style43">紅利管理</td>
                        </tr>
                        <tr>
                          <td align="center">&nbsp;</td>
                          <td align="left" class="style2">紅利設定<br />
                            公司會員紅利管理<br />
                            個人會員紅利管理</td>
                        </tr>
                        <tr>
                          <td colspan="2" align="center"><img src="../../../images/dotsline.png" alt="" width="167" height="11" /></td>
                        </tr>
                        <tr>
                          <td align="center"><span class="style17">＞</span></td>
                          <td align="left" class="style43">資訊管理</td>
                        </tr>
                        <tr>
                          <td align="center">&nbsp;</td>
                          <td align="left" class="style2">公告資訊管理<br />
                            公司資訊管理<br />
                            客服資訊管理<br />
                            Banner管理</td>
                        </tr>
                        <tr>
                          <td colspan="2"><img src="../../../images/dotsline.png" alt="" width="167" height="11" /></td>
                        </tr>
                        <tr>
                          <td align="center"><span class="style17">＞</span></td>
                          <td class="style43">權限管理</td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                          <td class="style2">新增使用者<br />
                            使用者設定<br />
                            群組設定<br />
                            使用者權限設定</td>
                        </tr>
                        <tr>
                          <td colspan="2"><img src="../../../images/dotsline.png" alt="" width="167" height="11" /></td>
                        </tr>
                    </table></td>
                    <td width="10"></td>
                  </tr>
              </table></td>
            </tr>
            <tr>
              <td width="180" height="28" align="center"><table width="0" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="180" height="28" align="center"><img src="../../../images/index_20.png" width="180" height="28" /></td>
                  </tr>
              </table></td>
            </tr>
          </table>
        </div>
        <!-- InstanceBeginEditable name="EditRegion1" -->
        <div id="contant_body">
          <div id="contant_body_header"></div>
          <div id="contant_body_body">
            <table cellpadding="0" cellspacing="0">
              <tr>
                <td colspan="3"><img src="../../../member/img/member_body_up.jpg" width="765" height="9" /></td>
              </tr>
              <tr>
                <td width="4" background="../../../member/img/member_body_left.jpg">&nbsp;</td>
                <td width="757"><div id="contnat_body_1"></div>
                  <div id="contant_body_2">
                    <table width="737" cellspacing="0" cellpadding="5">
                      <tr>
                        <td width="180"><form id="form1" name="form1" method="post" action="">
                          <label>
                            <input type="text" name="textfield" id="textfield" />
                            </label>
                        </form>
                        </td>
                        <td width="47"><form id="form2" name="form2" method="post" action="">
                          <label>
                            <input type="submit" name="button" id="button" value="搜尋" />
                            </label>
                        </form>
                        </td>
                        <td width="478"><form id="form3" name="form3" method="post" action="">
                          <label>
                            <select name="select" id="select">
                              <option>卡瑞塔思有限公司</option>
                            </select>
                            </label>
                        </form>
                        </td>
                      </tr>
                    </table>
                  </div>
                  <div id="contant_body_3">
                    <div>
                      <table width="737" cellspacing="0" cellpadding="5">
                        <tr>
                          <td bgcolor="#F1F1F1" class="style4"><div align="center">姓名</div></td>
                          <td bgcolor="#F1F1F1" class="style4"><div align="center">身分證號碼</div></td>
                          <td bgcolor="#F1F1F1" class="style4"><div align="center">所屬公司</div></td>
                          <td bgcolor="#F1F1F1" class="style4"><div align="center">會員狀態</div></td>
                        </tr>
                        <tr>
                          <td colspan="4"><?php do { ?>
                              <table width="100%" cellspacing="0" cellpadding="5">
                                <tr>
                                  <td width="15%" class="style4"><div align="center"><a href="admin_pearsonal_change.php?pm_id=<?php echo $row_personal_member_r['pm_id']; ?>"><?php echo $row_personal_member_r['name']; ?></a></div></td>
                                  <td width="32%" class="style4"><div align="center"><?php echo $row_personal_member_r['id_card']; ?></div></td>
                                  <td width="27%" class="style4"><div align="center"><?php echo $row_personal_member_r['company']; ?></div></td>
                                  <td width="26%" class="style4"><div align="center"><?php if($row_personal_member_r['p_status']==1){ echo "正常"; }else{ echo "停止使用"; } ?></div></td>
                                  </tr>
                              </table>
                              <?php } while ($row_personal_member_r = mysql_fetch_assoc($personal_member_r)); ?></td>
                          </tr>
                      </table>
                    </div>
                  </div>
                  <div id="contant_body_4">
                    <table width="100%" cellpadding="0" cellspacing="0" background="../../../List_pages/images/products_contant_text_3.jpg">
                      <tr>
                        <td><div align="right">
                            <table cellspacing="0" cellpadding="2">
                              <tr>
                                <td height="19"><?php if ($pageNum_personal_member_r > 0) { // Show if not first page ?>
                                    <a href="<?php printf("%s?pageNum_personal_member_r=%d%s", $currentPage, 0, $queryString_personal_member_r); ?>"><img src="../../../List_pages/images/page_left_1.jpg" width="17" height="13" border="0" /></a>
                                    <?php } // Show if not first page ?></td>
                                <td class="style4"><?php 
# variable declaration
$prev_personal_member_r = '<img src="../../../List_pages/images/page_left_2.jpg" width="14" height="13" border="0" />';
$next_personal_member_r = '<img src="../../../List_pages/images/page_right_2.jpg" width="14" height="13" border="0" />';
$separator = " | ";
$max_links = 10;
$pages_navigation_personal_member_r = buildNavigation($pageNum_personal_member_r,$totalPages_personal_member_r,$prev_personal_member_r,$next_personal_member_r,$separator,$max_links,true); 

print $pages_navigation_personal_member_r[0]; 
?>
                                  <?php print $pages_navigation_personal_member_r[1]; ?> <?php print $pages_navigation_personal_member_r[2]; ?></td>
                                <td><?php if ($pageNum_personal_member_r < $totalPages_personal_member_r) { // Show if not last page ?>
                                    <a href="<?php printf("%s?pageNum_personal_member_r=%d%s", $currentPage, $totalPages_personal_member_r, $queryString_personal_member_r); ?>"><img src="../../../List_pages/images/page_right_1.jpg" width="17" height="13" border="0" /></a>
                                    <?php } // Show if not last page ?></td>
                                <td>&nbsp;</td>
                              </tr>
                            </table>
                        </div></td>
                      </tr>
                    </table>
                  </div></td>
                <td width="4" background="../../../member/img/member_body_right.jpg">&nbsp;</td>
              </tr>
              <tr>
                <td height="9" colspan="3"><img src="../../../member/img/member_body_down.jpg" width="765" height="9" /></td>
              </tr>
            </table>
          </div>
        </div>
        <!-- InstanceEndEditable --></div>
      <div id="footer">
        <table width="955" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="230" height="118" align="center"><a href="index.html"><img width="200" height="66" alt="logo位置" style="background-color: #FF0000" /></a></td>
            <td width="10" align="center"><img src="../../../images/end_Separateline1.png" width="1" height="80" /></td>
            <td width="715" valign="middle"><table width="715" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="40" valign="top" class="style2"><table border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td width="50" align="center" class="style2"></td>
                        <td>本平台中台灣各店家所銷售的商品或服務，都是由各該店家所銷售或提供。 | 電話 : 02-2275-3588 | 傳真 : 02-2275-3788<br/>
                          微衡科技　版權所有 ⓒ 2011 Microbalance. All Rights Reserved.</td>
                      </tr>
                  </table></td>
                </tr>
            </table></td>
          </tr>
        </table>
      </div>
      </div></td>
  </tr>
</table>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($personal_member_r);
?>
